/**
 * 
 */
package com.leadership.api.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.leadership.entity.course.LdCourse;
import com.leadership.entity.course.CourseLearning;

/**
 * @author haiyan_xiao
 *
 */
@Dao("hibernate")
public interface CourseLearningDao {

    /**
     * 
     * @param email
     * @param course
     * @param projectId
     * @return
     */
    @Query("FROM CourseLearning WHERE completed = false AND email = :email AND course = :course AND projectId = :projectId")
    public CourseLearning load(@Variable("email") String email, @Variable("course") LdCourse course, @Variable("projectId") Long projectId);
    
    /**
     * 
     * @param email
     * @param trainingCourse
     * @return
     */
    @Query("FROM CourseLearning WHERE completed = false AND email = :email AND course.trainingCourse = :course")
    public List<CourseLearning> list(@Variable("email") String email, @Variable("course") String trainingCourse);
    
    /**
     * 
     * @param courses
     * @return
     */
    @Query("FROM CourseLearning WHERE completed = false AND course in (:courses) AND ")
    public List<CourseLearning> list(@Variable("courses") List<LdCourse> courses);

}
